package com.zzyl.nursing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.common.core.domain.entity.SysUser;
import com.zzyl.nursing.domain.NursingElder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 护理员老人关联Mapper接口
 *
 * @author ruoyi
 * @date 2024-05-28
 */
@Mapper
public interface NursingElderMapper extends BaseMapper<NursingElder> {

    /**
     * 查询护理员老人关联列表
     *
     * @param nursingElder 护理员老人关联
     * @return 护理员老人关联集合
     */
    @Select("")
    List<NursingElder> selectNursingElderList(NursingElder nursingElder);

    @Select("select tu.user_id as userId, tu.nick_name from nursing_elder ne, sys_user tu where ne.elder_id = " +
            "#{elderId} and tu.user_id = ne.nursing_id and tu.status = 0"
    )
    List<SysUser> selectUserByElderId(Long elderId);


}
